import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import "@/index/assets/css/Common.scss";
import "@/index/assets/css/scrollbar.css";
import "@/index/assets/css/reset.css";
import BaiduMap from 'vue-baidu-map'
import CKEditor from '@/index/ckeditor4/ckeditor_4.22.1_standard/ckeditor/ckeditor';

Vue.use(CKEditor)

Vue.use(BaiduMap, {ak: 'fr1Or3WZ1KYdaWwNapxDR1hs6IRwwLMs'});
Vue.use(ElementUI)

Vue.prototype.$formatDateTime = function (dateTime) {
    const date = new Date(dateTime);
    const year = date.getFullYear();
    const month = ('0' + (date.getMonth() + 1)).slice(-2); // 月份从0开始，需要加1并且补零
    const day = ('0' + date.getDate()).slice(-2); // 获取日期，并且补零
    const hours = ('0' + date.getHours()).slice(-2); // 获取小时，并且补零
    const minutes = ('0' + date.getMinutes()).slice(-2); // 获取分钟，并且补零
    const seconds = ('0' + date.getSeconds()).slice(-2); // 获取秒钟，并且补零

    return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
};


Vue.config.productionTip = false

const token = localStorage.getItem("token")
if (token !== null) {
    store.commit("setToken", token)
}



store.commit("setBaseUrl", process.env.VUE_APP_BASE_API)

new Vue({
    router, store, render: h => h(App)
}).$mount('#app')


